//
//  ZMyOrderManagerOrderCell.m
//  DistributorAB
//
//  Created by LZY on 2019/10/15.
//  Copyright © 2019 主事丫环. All rights reserved.
//

#import "ZMyOrderManagerOrderCell.h"

@interface ZMyOrderManagerOrderCell ()
@property (nonatomic, strong) UIImageView *ivShop;//产品图片
@property (nonatomic, strong) UILabel *lblName;//产品名称
@property (nonatomic, strong) UILabel *lblType;//产品类型
@property (nonatomic, strong) UILabel *lblNumber;//预订数量
@end

@implementation ZMyOrderManagerOrderCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self setupViewAction];
    }
    return self;
}
#pragma mark - 界面布局
- (void)setupViewAction{
    _ivShop = [[UIImageView alloc] initWithFrame:CGRectMake(16, 16, 60, 60)];
    _ivShop.backgroundColor =kColorWithHex(0xf2f2f2);
    [self.contentView addSubview:_ivShop];
    
    _lblName = [UILabel new];
    _lblName.font = [UIFont systemFontOfSize:14];
    _lblName.textColor = kColorWithHex(0x333333);
    _lblName.numberOfLines = 2;
    _lblName.preferredMaxLayoutWidth = kScreen_Width - 109;
    [self.contentView addSubview:_lblName];
    [_lblName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView.mas_top).offset(13);
        make.leading.equalTo(self.ivShop.mas_trailing).offset(13);
        make.trailing.equalTo(self.contentView.mas_trailing).offset(-21);
    }];
    
    UILabel *lblNoticeType = [UILabel new];
    lblNoticeType.text = @"型号";
    lblNoticeType.font = [UIFont systemFontOfSize:14];
    lblNoticeType.textColor = kColorWithHex(0x666666);
    [self.contentView addSubview:lblNoticeType];
    [lblNoticeType mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.lblName.mas_bottom).offset(7);
        make.leading.equalTo(self.lblName.mas_leading);
        make.height.mas_equalTo(19);
    }];
    
    _lblType = [UILabel new];
    _lblType.font = [UIFont boldSystemFontOfSize:14];
    _lblType.textColor = kColorWithHex(0x272727);
    [self.contentView addSubview:_lblType];
    [_lblType mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(lblNoticeType.mas_centerY);
        make.leading.equalTo(lblNoticeType.mas_trailing).offset(12);
        make.height.mas_equalTo(20);
    }];
    
    //当前需求 去掉数量显示
//    UILabel *lblNoticeNumber = [UILabel new];
//    lblNoticeNumber.text = @"数量";
//    lblNoticeNumber.font = [UIFont systemFontOfSize:14];
//    lblNoticeNumber.textColor = kColorWithHex(0x666666);
//    [self.contentView addSubview:lblNoticeNumber];
//    [lblNoticeNumber mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.leading.equalTo(lblNoticeType.mas_leading);
//        make.top.equalTo(lblNoticeType.mas_bottom).offset(8);
//        make.height.mas_equalTo(19);
//    }];
//
//    _lblNumber = [UILabel new];
//    _lblNumber.font = [UIFont systemFontOfSize:14];
//    _lblNumber.textColor = kColorWithHex(0x4a4a4a);
//    [self.contentView addSubview:_lblNumber];
//    [_lblNumber mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.centerY.equalTo(lblNoticeNumber.mas_centerY);
//        make.leading.equalTo(self.lblType.mas_leading);
//        make.height.mas_equalTo(20);
//    }];
    
    UIView *viewLine = [[UIView alloc] initWithFrame:CGRectMake(0, 122, kScreen_Width, 1)];
    viewLine.backgroundColor = kColorWithHex(0xf2f2f2);
    [self.contentView addSubview:viewLine];
}
#pragma mark - 数据更新
- (void)setPartModel:(BShopPartModel *)partModel{
    if (partModel) {
        _partModel = partModel;
        [HFTools imageViewUpdateWithUrl:partModel.image_url withImageView:_ivShop withPlaceholderImage:@""];
        _lblName.text = partModel.parts_name;
        _lblType.text = partModel.name;
    }
}

+ (CGFloat)cellHeight{
    return 123.0;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
